﻿<%-- Default.aspx -----------------------------------------------------------
   *
   * Informatix Football Apps
   * QB Passing Efficiency Calculator (SharePoint App)
   *
   * © 2013 Jason Barkes - http://jbarkes.blogspot.com
   --------------------------------------------------------------------------%>

<%@ Page Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" Language="C#" %>

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%-- The markup and script in the following Content element will be placed in the <head> of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

    <!-- CSS links -->
    <link rel="Stylesheet" type="text/css" href="../Content/App.css" />

    <!-- JavaScript links -->
    <script type="text/javascript" src="../Scripts/jquery-1.6.2.min.js"></script>
    <script type="text/javascript" src="../Scripts/App.js"></script>

    <!-- The following script runs when the DOM is ready. The inline code uses a SharePoint feature to ensure the -->
    <!-- SharePoint script file 'sp.js' is loaded, then executes the sharePointReady() function in 'App.js'. -->
    <script type="text/javascript">
        $(document).ready(function () {
            SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () { sharePointReady(); });
        });
    </script>

</asp:Content>

<asp:Content ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
    QB Passing Efficiency Calculator
</asp:Content>

<asp:Content ContentPlaceHolderID="PlaceHolderPageDescription" runat="server">
    This app calculates a quarterback's NFL and NCAA passing efficiency ratings.
</asp:Content>

<%-- The markup and script in the following Content element will be placed in the <body> of the page --%>
<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">

    <table class="qbr-container-table">
        <tr class="qbr-title-row">
            <td>&nbsp;</td>
            <td><a href="#" class="show_calcs">Calculations</a></td>
        </tr>
        
        <tr class="qbr-content-row">
            <td>
                <!-- Passing stats input -->
                <table class="qbr-stats-table">
                    <tr>
                        <td>Completions:</td>
                        <td><input type="text" id="ctl_completions" size="5" maxlength="5"></td>
                    </tr>
                    <tr>
                        <td>Attempts:</td>
                        <td><input type="text" id="ctl_attempts" size="5" maxlength="5"></td>
                    </tr>
                    <tr>
                        <td>Passing Yards:</td>
                        <td><input type="text" id="ctl_yards" size="5" maxlength="5"></td>
                    </tr>
                    <tr>
                        <td>Passing TDs:</td>
                        <td><input type="text" id="ctl_tds" size="5" maxlength="5"></td>
                    </tr>
                    <tr>
                        <td>Interceptions:</td>
                        <td><input type="text" id="ctl_ints" size="5" maxlength="5"></td>
                    </tr>
                    <tr id="ncaa-rating-row">
                        <td>NCAA Rating:</td>
                        <td><input type="text" id="ctl_ncaaRating_lt" class="result" size="5" maxlength="5" readonly></td>
                    </tr>
                    <tr id="nfl-rating-row">
                        <td>NFL Rating:</td>
                        <td><input type="text" id="ctl_nflRating_lt" class="result" size="5" maxlength="5" readonly title="Perfect rating is 158.3"></td>
                    </tr>
                    <tr class="ifx-logo-row"><td colspan="2"><img class="ifx-logo" src="../Images/IfxLogo.png" alt="Informatix Football" /></td></tr>
                    <tr>
                        <td colspan="2">
                            <input type="RESET" id="btn_reset" value="Reset">
                            <input type="BUTTON" id="btn_calc" value="Calculate" onclick="calc_ratings();">
                        </td>
                    </tr>
                </table>
            </td>

            <td class="qbr-calcs-col">
                <div class="qbr-calcs-panel">

                    <!-- NFL results -->
                    <h3 class="qbr-calcs-title">NFL Formula</h3>
                    <table class="qbr-calcs-table">

                        <!-- Completions -->
                        <tr>
                            <td align="right">( Completion % </td>
                            <td><input type="text" id="ctl_cp" size="6" maxlength="6" readonly></td>
                            <td align="middle">- 30 ) * 0.05</td>
                            <td align="right">=</td>
                            <td><input type="text" id="ctl_cpComp" size="5" maxlength="5" readonly></td>
                            <td>( <input type="text" id="ctl_cpFormula" size="5" maxlength="5" readonly title="Between 0 and 2.375"> )</td>
                            <td>&nbsp;&nbsp;A</td>
                        </tr>

                        <!-- Yards -->
                        <tr>
                            <td align="right">( Yards / Attempt </td>
                            <td><input type="text" id="ctl_ya" size="6" maxlength="6" readonly></td>
                            <td align="middle">- 3 ) * 0.25</td>
                            <td align="right">=</td>
                            <td><input type="text" id="ctl_yaComp" size="5" maxlength="5" readonly></td>
                            <td>( <input type="text" id="ctl_yaFormula" size="5" maxlength="5" readonly title="Between 0 and 2.375"> )</td>
                            <td>&nbsp;&nbsp;B</td>
                        </tr>

                        <!-- TDs -->
                        <tr>
                            <td align="right">Touchdown % </td>
                            <td><input type="text" id="ctl_tp" size="6" maxlength="6" readonly></td>
                            <td align="middle">* 0.2</td>
                            <td align="right">=</td>
                            <td><input type="text" id="ctl_tpComp" size="5" maxlength="5" readonly></td>
                            <td>( <input type="text" id="ctl_tpFormula" size="5" maxlength="5" readonly title="Less than 2.375"> )</td>
                            <td>&nbsp;&nbsp;C</td>
                        </tr>

                        <!-- Interceptions -->
                        <tr>
                            <td align="right">2.375 - ( Interception % </td>
                            <td><input type="text" id="ctl_ip" size="6" maxlength="6" readonly></td>
                            <td align="middle">* 0.25 )</td>
                            <td align="right">=</td>
                            <td><input type="text" id="ctl_ipComp" size="5" maxlength="5" readonly></td>
                            <td>( <input type="text" id="ctl_ipFormula" size="5" maxlength="5" readonly title="Greater than or equal to 0"> )</td>
                            <td>&nbsp;&nbsp;D</td>
                        </tr>

                    </table>
                    
                    <!-- Final NFL calculation -->
                    <table class="nfl-final-calc-table">
                        <tr>
                            <td>(</td>
                            <td><input type="text" id="ctl_cpFinal" size="5" maxlength="5" readonly title="Between 0 and 2.375"></td>
                            <td>+</td> 
                            <td><input type="text" id="ctl_yaFinal" size="5" maxlength="5" readonly title="Between 0 and 2.375"></td>
                            <td>+</td> 
                            <td><input type="text" id="ctl_tpFinal" size="5" maxlength="5" readonly title="Less than 2.375"></td>
                            <td>+</td>
                            <td><input type="text" id="ctl_ipFinal" size="5" maxlength="5" readonly title="Greater than or equal to 0"></td>
                            <td>) / 6 =</td> 
                            <td>
                                <input type="text" id="ctl_nflRatingAdj"    size="5" maxlength="5" readonly> * 100 = 
                            </td>
                            <td><input type="text" id="ctl_nflRating" class="result" size="5" maxlength="5" readonly title="Perfect rating is 158.3"></td>
                        </tr>
                        <tr align="middle"><td></td><td>A</td><td></td><td>B</td><td></td><td>C</td><td></td><td>D</td><td></td><td></td>
                            <td>NFL</td>
                        </tr>
                    </table>
                    <br />

                    <!-- NCAA results -->
                    <h3 class="qbr-calcs-title">NCAA Formula</h3>
                    <table class="ncaa-calcs-table">

                        <!-- Completions -->
                        <tr>
                            <td align="right">Completion %</td>
                            <td></td>
                            <td align="middle"></td>
                            <td align="right">=</td>
                            <td><input type="text" id="ctl_cpNcaaComp" size="5" maxlength="5" readonly></td>
                            <td>&nbsp;&nbsp;A</td>
                        </tr>

                        <!-- Yards -->
                        <tr>
                            <td align="right">Yards / Attempt</td>
                            <td><input type="text" id="ctl_yaNcaa" size="6" maxlength="6" readonly></td>
                            <td align="middle">* 8.4</td>
                            <td align="right">=</td>
                            <td><input type="text" id="ctl_yaNcaaComp" size="5" maxlength="5" readonly></td>
                            <td>&nbsp;&nbsp;B</td>
                        </tr>

                        <!-- TDs -->
                        <tr>
                            <td align="right">Touchdown %</td>
                            <td><input type="text" id="ctl_tpNcaa" size="6" maxlength="6" readonly></td>
                            <td align="middle">* 3.3</td>
                            <td align="right">=</td>
                            <td><input type="text" id="ctl_tpNcaaComp" size="5" maxlength="5" readonly></td>
                            <td>&nbsp;&nbsp;C</td>
                        </tr>

                        <!-- Interceptions -->
                        <tr>
                            <td align="right">Interception %</td>
                            <td><input type="text" id="ctl_ipNcaa" size="6" maxlength="6" readonly></td>
                            <td align="middle">* 2.0</td>
                            <td align="right">=</td>
                            <td><input type="text" id="ctl_ipNcaaComp" size="5" maxlength="5" readonly></td>
                            <td>&nbsp;&nbsp;D</td>
                        </tr>
                    </table>

                    <!-- Final NCAA calculation -->
                    <table class="ncaa-final-calc-table">
                        <tr>
                            <td><input type="text" id="ctl_cpNcaaFinal" size="5" maxlength="5" readonly></td>
                            <td>+</td> 
                            <td><input type="text" id="ctl_yaNcaaFinal" size="5" maxlength="5" readonly></td>
                            <td>+</td> 
                            <td><input type="text" id="ctl_tpNcaaFinal" size="5" maxlength="5" readonly></td>
                            <td>-</td>
                            <td><input type="text" id="ctl_ipNcaaFinal" size="5" maxlength="5" readonly></td>
                            <td>=</td>
                            <td><input type="text" id="ctl_ncaaRating" class="result" size="5" maxlength="5" readonly></td>
                        </tr>
                        <tr align="middle"><td>A</td><td></td><td>B</td><td></td><td>C</td><td></td><td>D</td><td></td>
                            <td>NCAA</td>
                        </tr>
                        <tr><td>&nbsp;</td></tr>
                    </table>
                </div>
            </td>
        </tr>
    </table>
    
    <!-- Footer -->
    <div class="footer">
        <span>&copy; 2013 Informatix & Jason Barkes</span><span>&nbsp;&nbsp;|&nbsp;&nbsp;</span>
        <span><a href="http://jbarkes.blogspot.com" target="_blank">Blog</a></span>
    </div>

</asp:Content>
